import * as BaseApi from './BaseApi.js';


import * as Config from './Config.js';

export const addMaintainColumn = (goodsId,columnName) => {

    let params={}
    params.token=sessionStorage.getItem("token")
    params.merchantId=sessionStorage.getItem("merchantId")
    params.goodsId=goodsId
    params.columnName=columnName

  return BaseApi.requestForm(Config.g_biz_url,'/goods/maintain/columnadd', params)
    .then(res => res)

}

export const queryColuMainInfo = (maintainColumnGroupId) => {
  
      let params={}
      params.token=sessionStorage.getItem("token")
      params.merchantId=sessionStorage.getItem("merchantId")
      params.maintainColumnGroupId=maintainColumnGroupId
  
    return BaseApi.requestForm(Config.g_biz_url,'/goods/maintain/linkquery', params)
      .then(res => res)

}
export const queryMaintainColumn = (goodsId) => {
    
        let params={}
        params.token=sessionStorage.getItem("token")
        params.merchantId=sessionStorage.getItem("merchantId")
        params.goodsId=goodsId
    
      return BaseApi.requestForm(Config.g_biz_url,'/goods/maintain/columnquery', params)
        .then(res => res)
 
}

export const addColumnGroup = (columnId,groupName) => {
    
        let params={}
        params.token=sessionStorage.getItem("token")
        params.merchantId=sessionStorage.getItem("merchantId")
        params.columnId=columnId
        params.groupName = groupName
    
      return BaseApi.requestForm(Config.g_biz_url,'/goods/maintain/columngroupadd', params)
        .then(res => res)
    
}


export const queryColumnandGroup = (goodsId) => {
    
        let params={}
        params.token=sessionStorage.getItem("token")
        params.merchantId=sessionStorage.getItem("merchantId")
        params.goodsId=goodsId
    
      return BaseApi.requestForm(Config.g_biz_url,'/goods/maintain/columnandgroupquery', params)
        .then(res => res)
    
}


export const queryMaintainList =  (catId,carIdList) => {
        let params={}
        params.token=sessionStorage.getItem("token")
        params.merchantId=sessionStorage.getItem("merchantId")
        params.linkType = "CAR"
        params.linkIds=carIdList
        params.catId = catId
    
      return BaseApi.requestForm(Config.g_biz_url,'/maintain/info/query', params)
        .then(res => res)
    
}

export const addMaintainLinkAdd =  (carIdList,groupId,infoId) => {
    let params={}
    params.token=sessionStorage.getItem("token")
    params.merchantId=sessionStorage.getItem("merchantId")
    params.linkType = "CAR"
    params.linkIds=carIdList
    params.maintainColumnGroupId = groupId
    params.maintainInfoIds=infoId

  return BaseApi.requestForm(Config.g_biz_url,'/goods/maintain/linkadd', params)
    .then(res => res)

}


// POST /goods/maintain/linkadd


// http://116.62.22.58:8030/goods/maintain/columnandgroupquery





    